At present, hard disk drives are one of the most common forms of electronic data storage devices. Hard disk drives typically contain multiple magnetic disks (“platters”) which serve as the storage media. The platters are rotated and magnetic heads write data as a series of magnetic polarity transitions in a plurality of concentric circular tracks on the surfaces of the platters. For example, a track region of uniform magnetic polarity can represent a “0” and a track region containing a transition from one magnetic polarity to the opposite magnetic polarity can represent a “1”, where each “0” or “1” constitutes a bit. The magnetic heads can also read stored data by moving into position over particular tracks and detecting these magnetic polarity transitions (or the absence thereof) as the platters rotate beneath.
Each platter is divided into geometrical sectors. The intersections of geometrical sectors and the concentric circular tracks define data sectors. Each data sector typically consists of 512 bytes, and each byte typically consists of 8 bits. A block, which typically represents the smallest storage unit that can be allocated for storing data, consists of a contiguous group of data sectors. For example, a 4 kilobyte block typically consists of 8 contiguous data sectors (i.e., 512 byte sectors).
An ever-present concern in hard disk drive technology is adjacent track interference (ATI) and wide area adjacent track erasure (ATE). ATI occurs when a head successively writes data on a particular track of a platter and the magnetic field of the head weakens the magnetic polarity transitions on adjacent tracks, potentially to the extent that the data on the adjacent tracks becomes unreadable. ATE is a similar effect that has the potential to corrupt data on a larger number of adjacent tracks. For example, if data stored on track N is frequently modified (e.g., the head is frequently performing writes to that track region), data located on adjacent tracks N+1 and N−1 that is near the high-write region of track N can be subject to ATI and ATE. As the disparity in write frequencies of data on adjacent tracks becomes greater, the potential for ATI and ATE typically increases. For example, infrequently written data that is adjacent to a track region with a high write frequency is especially susceptible to ATI and ATE.
A file system enables applications to store and access data on a hard disk drive. To store a file on a hard disk drive using a typical file system, the file system must initially allocate a whole number of free blocks for the file to use. Based on the anticipated size of a file to be stored, an application can issue allocation requests to the file system for the appropriate number of free blocks. Later, if the size of the file increases, the file system can allocate additional free blocks; if the file size is reduced or the file is deleted, the file system can free the file's allocated blocks for future allocation.
Generally, the file system will allocate a contiguous group of free blocks for a file because this method can ultimately enable faster access to the file. For example, if all blocks allocated for a file are contiguous on a single track, the entire file can be accessed on a single platter rotation (i.e., reduced rotational latency) and without having to move the heads to multiple tracks (i.e., reduced seek time).
However, if a contiguous group of free blocks is not available during initial allocation or a subsequent increase in file size, a single file may be allocated free blocks that are non-contiguously distributed over the tracks of a platter or multiple platters within the stack of a hard disk drive. The resulting non-contiguous distribution of blocks of a file (“fragments”) is referred to as fragmentation, and each fragment of a file can consist of one block or multiple contiguous blocks. Fragmentation, in contrast to a contiguous distribution of blocks of a file, can negatively affect system and hard disk drive performance on account of increased rotational latency and seek times. To ameliorate these negative effects, disk defragmentation software can be used to consolidate fragments of files on a hard disk drive by relocating the fragmented blocks of files such that they are contiguous on the hard disk drive.
A common defragmentation method employed by defragmentation software involves consolidating movable fragments of files such that the blocks of each file are contiguous and located on outer tracks. Consolidating movable fragments on outer tracks can help improve file access times because of the higher media transfer rates of outer tracks (i.e., with zone bit recording and constant rotational velocity of platters, the greater linear velocity and quantity of blocks on outer tracks enables more of those blocks to be accessed by a head per unit of time relative to blocks on inner tracks). Some defragmentation software further considers the size of each fragment and may not consolidate otherwise movable fragments of a file if those fragments consist of a sufficiently large number of contiguous blocks. For example, if a fragment consists of a sufficiently large number of contiguous blocks (e.g., 64 MB of combined storage space) such that any potential performance gains (e.g., reduced seek times) are negligible compared to the time it takes to read the large fragment, defragmentation software may not consolidate that fragment because it may be a waste of system resources.
As a consequence of giving preference to outer tracks during defragmentation, blocks within these regions will often experience a high number of writes, while blocks on inner tracks adjacent to these high-write regions will often experience a lesser number of writes. Similarly, blocks located on the outer tracks that contain immovable data may experience substantially fewer writes than the neighboring blocks to which data is frequently written during defragmentation. Accordingly, this defragmentation method can result in a distribution of blocks that is ripe for ATI and ATE effects.
One technique to minimize the potential for ATI and ATE involves reducing the number of tracks per inch (TPI) on the platters. By decreasing the TPI, tracks are spaced farther apart, which can help reduce the extent to which the heads' magnetic fields affect the data stored on adjacent tracks. However, decreasing the TPI typically reduces the storage capacity of a platter. Further, decreasing TPI can result in poorer performance due to increased seek times.
Other techniques to minimize the potential for ATI and ATE involve periodically performing refresh cycles. In a typical refresh cycle, the data on a track that is potentially subject to ATI and ATE is read and then rewritten in the same location. Rewriting the data helps ensure its continued integrity by strengthening the magnetic polarity transitions that may have been weakened by ATI and ATE. The tracks on which to perform refresh cycles can be determined by monitoring the number of write operations on each track and, upon reaching a threshold number of write operations for a given track, performing a refresh cycle on the tracks adjacent to that track. However, performing refresh cycles can negatively impact performance on account of increased seek times and because certain read and write functions cannot be performed during refresh cycles. Further, performing refresh cycles can involve additional head movement, additional platter rotations, and other hard disk drive processes that may increase power consumption.